import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import 'package:provider/provider.dart';
import 'routes/Routes.dart';
import 'utils/Global.dart';
import 'providers/CurrentIndexProvider.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

void main() {
  // 注册路由
  final router = FluroRouter();
  Routes.configRoutes(router);

  // 路由信息添加到全局
  G.router = router;

  runApp(
    MultiProvider(
      providers: [
        ChangeNotifierProvider.value(value: CurrentIndexProvider()),
      ],
      child: MyApp(),
    ),
  );
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: Size(750, 1334),
      allowFontScaling: false,
      builder: () => MaterialApp(
        title: '学习平台',
        // home: Index(),
        onGenerateRoute: G.router.generator,
        initialRoute: '/login',
      ),
    );
  }
}